package com.framework.base.taglib.ui; 

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.framework.base.util.OperationPaserUtil;

/**
 * @Description:功能描述
 * @Company: framework
 * @author：刘明云
 * @version 1.0
 * @Date 2011-6-20 上午11:29:49
 */
@SuppressWarnings("serial")
public class OperationTag extends TagSupport {
	  private String operation;
	  public OperationTag() {
	    operation=null;
	  }
	  /**
	   *
	   * @return
	   * @throws JspException
	   */
	  public int doStartTag() throws JspException{
	     boolean hasPermission=false;
	    try {
	      hasPermission = new OperationPaserUtil().parseRight(getOperation(),
	          pageContext.getServletContext(), pageContext.getSession());
	    }
	    catch (Exception ex) {
	      ex.printStackTrace();
	      throw new JspException(ex);
	    }
	     if(hasPermission)
	     return EVAL_BODY_INCLUDE;
	      return SKIP_BODY;
	   }

	  public String getOperation() {
	    return operation;
	  }
	  public void setOperation(String operation) {
	    this.operation = operation;
	  }
}
